﻿using Mt.Site.Core.WorkFlows.Design.Entities;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Mt.Site.Core.WorkFlows.Design
{
    /// <summary>
    /// 工作流设计
    /// (通过表单、配置文件等定制工作流，并持久化到数据库)
    /// </summary>
    public interface IWorkflowDesignService
    {
        Task CreateCategoryAsync(WorkFlowCategeory entity);
        Task UpdateCategoryAsync(WorkFlowCategeory entity);
        Task DeleteCategoryAsync(Guid id);

        #region 流程
        Task CreateDesignAsync(WorkFlow entity);
        Task UpdateDesignAsync(WorkFlow entity);
        Task DeleteDesignAsync(Guid id);

        Task<bool> IsHasPapers(Guid workFlowId);
        Task<int> CheckPapersCountAsync(Guid workFlowId);
        Task CopyWorkFlowDefinitionAsync(Guid workFlowId);

        #endregion

        #region 流程表单
        Task CreateWorkFlowFormAsync(WorkFlowForm entity);

        Task UpdateWorkFlowFormAsync(WorkFlowForm entity);

        Task DeleteWorkFlowFormAsync(Guid id);
        #endregion

        #region 流程环节
        Task CreateWorkFlowNodeAsync(WorkFlowNode entity);

        Task UpdateWorkFlowNodeAsync(WorkFlowNode entity);

        Task<bool> CanNodeBeRemoveOrEdit(WorkFlowNode node, List<WorkFlowNode> allBrotherNodes);

        #endregion

    }
}
